﻿namespace WorkflowSharp.SimpleTest
{
    class ConditionA : ICondition<bool>
    {
    }

    class ConditionB : ICondition<bool>
    {
    }

    class ActionA : IAction
    {
    }

    class ActionB : IAction
    {
    }

    class SignalA : ISignal
    {
    }

    class SignalB : ISignal
    {
    }

    class Program
    {
        static void Main()
        {
            Workflow workflow = new Workflow();
            workflow.condition<ConditionA, bool>()
                .on(true)
                    .parallel()
                        .sequence()
                            .execute<ActionA>()
                                .with("speed", 1f)
                                .with("distance", 100)
                            .end()
                            .condition<ConditionB, bool>()
                                .on(true)
                                   .execute<ActionA>()
                                       .with("speed", 0.5f)
                                       .with("distance", 50)
                                   .end()
                                   .emit<SignalA>()
                                   .end()
                                   .wait<SignalB>()
                                   .end()
                               .end()
                               .on(false)
                                   .execute<ActionA>()
                                       .with("speed", 0.5f)
                                       .with("distance", 30)
                                   .end()
                               .end()
                           .end()
                        .end()
                        .execute<ActionB>()
                        .end()
                    .end()
                .end()
            .end();

            WorkflowRuntime r = new WorkflowRuntime();
            r.run(workflow);
        }
    }
}
